// pages/my/my.js
const app = getApp()
import http from "../../utils/http"
import util from "../../utils/util"
Page({

  /**
   * 页面的初始数据
   */
  data: {
    moreList:[
      {img:'../../static/index/my/my-1.png',title:'加入申请',url:'/service/applicant/applicant'},
      {img:'../../static/index/my/my-2.png',title:'意见反馈',url:'/service/feedback/feedback'},
      {img:'../../static/index/my/my-3.png',title:'平台公告',url:'/service/notice/notice'},
      {img:'../../static/index/my/my-4.png',title:'店铺评价',url:'/service/comments/comments'},
      {img:'../../static/index/my/my-5.png',title:'培训中心',url:'/service/exercise/exercise'},
      {img:'../../static/index/my/my-6.png',title:'联系客服'},
      {img:'../../static/index/my/my-7.png',title:'提现绑定',url:'/service/account/account'},
      {img:'../../static/index/my/my-8.png',title:'提现审核',url:'../../service/txAudit/txAudit'},
      {img:'../../static/index/my/my-9.png',title:'提现设置',url:'../../service/txIntendant/txIntendant'},
      {img:'../../static/index/my/my-11.png',title:'优惠券管理',url:'/service/yhq/yhq'},
      {img:'../../static/index/my/my-10.png',title:'设置',url:'/service/set/set'},
      {img:'../../static/index/my/my-8.png',title:'退款审核',url:'../../service/refundorder/refundorder'},
      {img:'../../static/index/my/my-12.png',title:'海报',url:'../../service/poster/poster'},
    ],
    service:false,
    info: '',
    config: ''
  },
  onLoadConfig(option){
    this.setData({
      config: app.globalData.config
    })
  },
  copy(event){
    wx.setClipboardData({
      data: ``+event.currentTarget.dataset.content,
      success (res) {
        util.toast('已复制')
      },
      fail:(e)=>{
        console.log(e)
      }
    })
  },
  toServel(e){
    util.authSkip(e.currentTarget.dataset.url)
  },
  // 跳转余额
  toBalance(){
    util.authSkip('/service/balance/balance')
 
  },
  //保证金
  toEarnestMoney(){
    util.authSkip('/service/earnestMoney/earnestMoney')
  },
  // 跳转服务者
  toserviceStaff(){
    util.authSkip('/service/serviceStaff/serviceStaff')
  },
  //跳转平台项目
  toserveList(){
    util.authSkip('/service/serveList/serveList')
  },
  //跳转店铺项目
  tostoreItem(){
    util.authSkip('/service/toreItem/toreItem')
  },
  tologin(){
    util.skip('/service/login/login')
  },
  getInfo(){
    if(!wx.getStorageSync('token')) return
    http.get('shop/shopindex','',!this.data.info).then(res => {
      this.data.moreList[3].url = '/service/comments/comments?type=shop&id='+res.data.shopInfo.id
      this.setData({
        info: res.data,
        moreList: this.data.moreList
      })
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getInfo()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})